<template>
    <div>
        <h2>注册会员信息</h2>
        <table border="5">
            <tbody>
                <tr>
                    <td>账号</td>
                    <td>
                        <input type="text" placeholder="请输入用户名" v-model="info.Card">
                    </td>
                </tr>
                <tr>
                    <td>密码</td>
                    <td>
                        <input type="password" placeholder="请输入密码" v-model="info.Pwd">
                    </td>
                </tr>
                <tr>
                    <td>姓名</td>
                    <td>
                        <input type="text" placeholder="请输入姓名" v-model="info.Name">
                    </td>
                </tr>
                <tr>
                    <td>性别</td>
                    <td>
                        <input type="text" placeholder="请输入性别" v-model="info.Sex">
                    </td>
                </tr>
               <tr>
                    <td>手机号</td>
                    <td>
                        <input type="text" placeholder="请输入手机号" v-model="info.Phone">
                    </td>
                </tr>
                <tr>
                    <td></td>
                    <td>
                        <input type="button" value="添加会员信息" @click="MemberAdd">
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</template>

<script setup lang="ts">
import{ref,reactive,onMounted}from 'vue';
import axios from 'axios';
import { useRouter } from 'vue-router';

const router=useRouter();

const info = ref({
    Card:'',
    Pwd:'',
    Name:'',
    Sex:'',
    Phone:'',
})

const MemberAdd=()=>{
    axios.post("https://localhost:7162/api/Member/MemberAdd",{
        Card:info.value.Card,
        Pwd:info.value.Pwd,
        Name:info.value.Name,
        Sex:info.value.Sex,
        Phone:info.value.Phone,
    })
    .then(res=>{
        if(res.data>0){
            alert("添加成功");
            return;
        }
        else{
            alert("添加失败");
            return;
        }
    })
}
</script>